﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="4_3.aspx.cs" Inherits="项目4._4_3" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body style="font-size: x-large">
    <form id="form1" runat="server">
    <div>
    
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" Text="Button" />
        <br />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="id" DataSourceID="SqlDataSource1" AllowPaging="True" 
            AllowSorting="True">
            <Columns>
                <asp:BoundField DataField="id" HeaderText="id" ReadOnly="True" 
                    SortExpression="id" />
                <asp:BoundField DataField="title" HeaderText="title" SortExpression="title" />
                <asp:BoundField DataField="content" HeaderText="content" 
                    SortExpression="content" />
                <asp:BoundField DataField="createTime" HeaderText="createTime" 
                    SortExpression="createTime" />
                <asp:BoundField DataField="caId" HeaderText="caId" SortExpression="caId" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:systemConnectionString %>" 
            
            SelectCommand="SELECT * FROM [news] WHERE (([title] LIKE '%' + @title + '%') AND ([title] LIKE '%' + @title2 + '%'))" 
            DeleteCommand="DELETE FROM [news] WHERE [id] = @id" 
            InsertCommand="INSERT INTO [news] ([id], [title], [content], [createTime], [caId]) VALUES (@id, @title, @content, @createTime, @caId)" 
            
            UpdateCommand="UPDATE [news] SET [title] = @title, [content] = @content, [createTime] = @createTime, [caId] = @caId WHERE [id] = @id">
            <DeleteParameters>
                <asp:Parameter Name="id" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="id" Type="Int32" />
                <asp:Parameter Name="title" Type="String" />
                <asp:Parameter Name="content" Type="String" />
                <asp:Parameter Name="createTime" Type="DateTime" />
                <asp:Parameter Name="caId" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="TextBox1" DefaultValue="大众" Name="title" 
                    PropertyName="Text" Type="String" />
                <asp:ControlParameter ControlID="TextBox1" DefaultValue="大众" Name="title2" 
                    PropertyName="Text" Type="String" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="title" Type="String" />
                <asp:Parameter Name="content" Type="String" />
                <asp:Parameter Name="createTime" Type="DateTime" />
                <asp:Parameter Name="caId" Type="String" />
                <asp:Parameter Name="id" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
